# -*- coding:utf-8
import random
import time

from mysql import connector


names = ['liruopeng','jinyaqia','chengzhiling']

fq = 1000

if __name__ == "__main__":
    conn = connector.connect(host='10.36.8.127',port='3306',user='root',password='123456',database='lee')
    cursor = conn.cursor()
    time1 = time.time()
    for _ in xrange(fq):
        name = names[random.randint(0,2)]
        math = random.randint(0,100)
        english = random.randint(0,100)
        chinese = random.randint(0,100)
        sql = "INSERT INTO score (name,math,english,chinese) VALUES (%s, %s, %s,%s)"
        data = (name,math,english,chinese)
        cursor.execute(sql,data)
    conn.commit()
    print time.time()-time1